package org.jix.weblog.module.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jix.weblog.module.admin.model.vo.tag.AddTagReqVO;
import org.jix.weblog.module.admin.model.vo.tag.DeleteTagVO;
import org.jix.weblog.module.admin.model.vo.tag.FindTagsPageListReqVO;
import org.jix.weblog.module.admin.model.vo.tag.SearchTagReqVO;
import org.jix.weblog.module.admin.service.AdminTagService;
import org.jix.weblog.module.common.aspect.ApiOperationLog;
import org.jix.weblog.module.common.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0
 * @Author Jix
 * @Date 2024/7/30 10:05
 * @注释
 */
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/admin")
@Api(tags = "Admin标签模块")
public class AdminTagController {

    @Autowired
    private AdminTagService adminTagService;

    @PostMapping("/tag/add")
    @ApiOperation(value = "添加标签")
    @ApiOperationLog(description = "添加标签")
    public Response addTags(@RequestBody @Validated AddTagReqVO addTagReqVO) {
        return adminTagService.addTag(addTagReqVO);
    }

    @PostMapping("/tag/list")
    @ApiOperation(value = "标签分页获取")
    @ApiOperationLog(description = "标签分页获取")
    public Response findTagsPageList(@RequestBody @Validated FindTagsPageListReqVO findTagsPageListReqVO){
        return adminTagService.findTagsPageList(findTagsPageListReqVO);

    }
    @PostMapping("/tag/delete")
    @ApiOperation(value = "删除标签")
    @ApiOperationLog(description = "删除标签")
    public Response deleteTag(@RequestBody @Validated DeleteTagVO deleteTagVO){
        return adminTagService.deleteTag(deleteTagVO);
    }
    @PostMapping("/tag/search")
    @ApiOperation(value = "标签模糊查询")
    @ApiOperationLog(description = "标签模糊查询")
    public Response searchTag(@RequestBody @Validated SearchTagReqVO searchTagReqVO){
        return adminTagService.searchTag(searchTagReqVO);
    }

    @PostMapping("/tag/select/list")
    @ApiOperation(value = "查询标签 Select 列表数据")
    @ApiOperationLog(description = "查询标签 Select 列表数据")
    public Response findTagSelectList() {
        return adminTagService.findTagSelectList();
    }
}
